It is useful for web page owners to understand how many users are viewing their web pages and how users interact with the web pages. Code to track this information may be embedded within the web pages, and typically involves downloading one or more other main scripts. As a user opens a web page or interacts with a web page, certain tracking events are captured and transmitted to a remote server.
Existing processes for downloading scripts create several problems. First, downloading one or more large scripts can be time consuming, so synchronous loading can create a perceptible delay to users. Second, the objects and functions defined within the script are not available until they are fully loaded, so important events may not be tracked if they occur before the loading is complete.
More generally, even if a script is loaded asynchronously, existing processes have no access to the objects or functions within the script until the script is fully loaded. Because the objects and functions cannot be accessed, the asynchronous loading is largely the same as synchronous loading.